package com.cyy.content.api;

import com.cyy.content.mapper.CourseTeacherMapper;
import com.cyy.content.model.po.CourseTeacher;
import com.cyy.content.service.CourseTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author cyy
 * @date 2025/1/21
 * @description CourseTeachController
 */
@Api(value = "课程教师编辑接口",tags = "课程教师编辑接口")
@RestController
public class CourseTeachController {

    @Autowired
    private CourseTeacherService courseTeacherService;


    @ApiOperation("教师列表接口")
    @GetMapping("/courseTeacher/list/{courseId}")
    public List<CourseTeacher> courseTeacherList(Long courseId){
        return courseTeacherService.courseTeacherList(courseId);
    }

    @ApiOperation("新增教师列表接口")
    @PostMapping("/courseTeacher")
    public void addCourseTeacher(CourseTeacher courseTeacher){
        courseTeacherService.save(courseTeacher);
    }

    @ApiOperation("查看教师详情接口")
    @GetMapping("/courseTeacher/{teacherId}")
    public CourseTeacher getCourseTeacher(Long teacherId){
        return courseTeacherService.getById(teacherId);
    }

    @ApiOperation("编辑教师详情接口")
    @PutMapping("/courseTeacher")
    public void editCourseTeacher(CourseTeacher courseTeacher){
        courseTeacherService.editCourseTeacher(courseTeacher);
    }

    @ApiOperation("删除教师详情接口")
    @GetMapping("/courseTeacher/course/{courseId}/{teacherId}")
    public void deleteCourseTeacher(@PathVariable Long courseId, @PathVariable Long teacherId){
        courseTeacherService.deleteCourseTeacher(courseId, teacherId);
    }
}
